// Object.assign()
const obj1 = { name: 'Moon' };
const obj2 = Object.assign({}, obj1);
obj2.name = 'Leslie';
console.info(obj1, obj2); // { name: 'Moon' } { name: 'Leslie' }


/// Spread Operator
const obj3 = {
    name: 'Nordan', detail: { age: 19 }
};

const obj4 = { ...obj3 };
obj3.name = 'Jordan';
obj4.detail.age = 20; // 此处会影响 obj3 的 detail.age
console.info(obj3, obj4); // { name: 'Jordan', detail: { age: 20 } } { name: 'Nordan', detail: { age: 20 } }